package com.qen.sheji.daili;

import java.lang.reflect.Proxy;

public class StaticClient {

    public static void main(String[] args) {
//        testStatic();

        testJdkProxy();


    }

    private static void testJdkProxy() {
        Subject real = new RealSubject();
        ProvyHandler handler = new ProvyHandler(real);
        Subject subject = (Subject) Proxy.newProxyInstance(handler.getClass().getClassLoader(), real.getClass().getInterfaces(), handler);
        subject.operation();
    }

    private static void testStatic() {

        StaticProxy proxy = new StaticProxy(new RealSubject());
        proxy.operation();

    }
}
